package com.dhcc.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.dhcc.dao.UserManagerDao;
import com.dhcc.model.Student;
import com.dhcc.model.Teacher;
import com.dhcc.model.User;
import com.dhcc.model.UserInsert;
import com.dhcc.service.UserService;

@Service("userService")
public class UserServiceImpl implements UserService{

	@Autowired
	private UserManagerDao userManagerDao;
	
	@Override
	public void save(User user) {
		userManagerDao.save(user);
	}

	@Override
	public void update(User user) {
		
	}

	@Override
	public void delete(User user) {
		
	}

	@Override
	public User get(Long id) {
		return null;
	}

	@Override
	public List<User> query() {
		List<User> users = userManagerDao.query();
		return users;
	}

	@Override
	public Student findStudentByUserId(int id) {
		Student student= userManagerDao.getStudentByUserId(id);
		return student;
	}

	@Override
	public User findUserByUserId(int userId) {
		User user = userManagerDao.getUserByUserId(userId);
		return user;
	}

	@Override
	public void upStudent(Student s) {
		userManagerDao.upStudentInfo(s);
	}

	@Override
	public void upUser(User u) {
		userManagerDao.upUserInfo(u);
	}

	@Override
	public List<Student> selectStudent(int page) {
		List<Student> list = userManagerDao.selectStudent1(page);
		return list;
	}

	@Override
	public List<Teacher> selectTeacher(int page) {
		List<Teacher> tea=userManagerDao.selectTeacher1(page);
		return tea;
	}

	@Override
	public void insertTeacher(UserInsert insert) {
		userManagerDao.insertTeacher1(insert);
		
	}

	@Override
	public void insertStudent(UserInsert insert) {
		userManagerDao.insertStudent1(insert);
		
	}

}
